<?php
App::uses('AppHelper', 'View/Helper');

/*
 * Simple helper untangling the mess that the introduction of fas / fab namespaces for icons brought in FA5+
 */
class FontAwesomeHelper extends AppHelper 
{
    const FAB_ICONS = array(
        '500px' => true,
        'accessible-icon' => true,
        'accusoft' => true,
        'acquisitions-incorporated' => true,
        'adn' => true,
        'adobe' => true,
        'adversal' => true,
        'affiliatetheme' => true,
        'airbnb' => true,
        'algolia' => true,
        'alipay' => true,
        'amazon' => true,
        'amazon-pay' => true,
        'amilia' => true,
        'android' => true,
        'angellist' => true,
        'angrycreative' => true,
        'angular' => true,
        'app-store' => true,
        'app-store-ios' => true,
        'apper' => true,
        'apple' => true,
        'apple-pay' => true,
        'artstation' => true,
        'asymmetrik' => true,
        'atlassian' => true,
        'audible' => true,
        'autoprefixer' => true,
        'avianex' => true,
        'aviato' => true,
        'aws' => true,
        'bandcamp' => true,
        'battle-net' => true,
        'behance' => true,
        'behance-square' => true,
        'bimobject' => true,
        'bitbucket' => true,
        'bitcoin' => true,
        'bity' => true,
        'black-tie' => true,
        'blackberry' => true,
        'blogger' => true,
        'blogger-b' => true,
        'bluetooth' => true,
        'bluetooth-b' => true,
        'bootstrap' => true,
        'btc' => true,
        'buffer' => true,
        'buromobelexperte' => true,
        'canadian-maple-leaf' => true,
        'cc-amazon-pay' => true,
        'cc-amex' => true,
        'cc-apple-pay' => true,
        'cc-diners-club' => true,
        'cc-discover' => true,
        'cc-jcb' => true,
        'cc-mastercard' => true,
        'cc-paypal' => true,
        'cc-stripe' => true,
        'cc-visa' => true,
        'centercode' => true,
        'centos' => true,
        'chrome' => true,
        'chromecast' => true,
        'cloudscale' => true,
        'cloudsmith' => true,
        'cloudversify' => true,
        'codepen' => true,
        'codiepie' => true,
        'confluence' => true,
        'connectdevelop' => true,
        'contao' => true,
        'cpanel' => true,
        'creative-commons' => true,
        'creative-commons-by' => true,
        'creative-commons-nc' => true,
        'creative-commons-nc-eu' => true,
        'creative-commons-nc-jp' => true,
        'creative-commons-nd' => true,
        'creative-commons-pd' => true,
        'creative-commons-pd-alt' => true,
        'creative-commons-remix' => true,
        'creative-commons-sa' => true,
        'creative-commons-sampling' => true,
        'creative-commons-sampling-plus' => true,
        'creative-commons-share' => true,
        'creative-commons-zero' => true,
        'critical-role' => true,
        'css3' => true,
        'css3-alt' => true,
        'cuttlefish' => true,
        'd-and-d' => true,
        'd-and-d-beyond' => true,
        'dashcube' => true,
        'delicious' => true,
        'deploydog' => true,
        'deskpro' => true,
        'dev' => true,
        'deviantart' => true,
        'dhl' => true,
        'diaspora' => true,
        'digg' => true,
        'digital-ocean' => true,
        'discord' => true,
        'discourse' => true,
        'dochub' => true,
        'docker' => true,
        'draft2digital' => true,
        'dribbble' => true,
        'dribbble-square' => true,
        'dropbox' => true,
        'drupal' => true,
        'dyalog' => true,
        'earlybirds' => true,
        'ebay' => true,
        'edge' => true,
        'elementor' => true,
        'ello' => true,
        'ember' => true,
        'empire' => true,
        'envira' => true,
        'erlang' => true,
        'ethereum' => true,
        'etsy' => true,
        'evernote' => true,
        'expeditedssl' => true,
        'facebook' => true,
        'facebook-f' => true,
        'facebook-messenger' => true,
        'facebook-square' => true,
        'fantasy-flight-games' => true,
        'fedex' => true,
        'fedora' => true,
        'figma' => true,
        'firefox' => true,
        'first-order' => true,
        'first-order-alt' => true,
        'firstdraft' => true,
        'flickr' => true,
        'flipboard' => true,
        'fly' => true,
        'font-awesome' => true,
        'font-awesome-alt' => true,
        'font-awesome-flag' => true,
        'fonticons' => true,
        'fonticons-fi' => true,
        'fort-awesome' => true,
        'fort-awesome-alt' => true,
        'forumbee' => true,
        'foursquare' => true,
        'free-code-camp' => true,
        'freebsd' => true,
        'fulcrum' => true,
        'galactic-republic' => true,
        'galactic-senate' => true,
        'get-pocket' => true,
        'gg' => true,
        'gg-circle' => true,
        'git' => true,
        'git-square' => true,
        'github' => true,
        'github-alt' => true,
        'github-square' => true,
        'gitkraken' => true,
        'gitlab' => true,
        'gitter' => true,
        'glide' => true,
        'glide-g' => true,
        'gofore' => true,
        'goodreads' => true,
        'goodreads-g' => true,
        'google' => true,
        'google-drive' => true,
        'google-play' => true,
        'google-plus' => true,
        'google-plus-g' => true,
        'google-plus-square' => true,
        'google-wallet' => true,
        'gratipay' => true,
        'grav' => true,
        'gripfire' => true,
        'grunt' => true,
        'gulp' => true,
        'hacker-news' => true,
        'hacker-news-square' => true,
        'hackerrank' => true,
        'hips' => true,
        'hire-a-helper' => true,
        'hooli' => true,
        'hornbill' => true,
        'hotjar' => true,
        'houzz' => true,
        'html5' => true,
        'hubspot' => true,
        'imdb' => true,
        'instagram' => true,
        'intercom' => true,
        'internet-explorer' => true,
        'invision' => true,
        'ioxhost' => true,
        'itch-io' => true,
        'itunes' => true,
        'itunes-note' => true,
        'java' => true,
        'jedi-order' => true,
        'jenkins' => true,
        'jira' => true,
        'joget' => true,
        'joomla' => true,
        'js' => true,
        'js-square' => true,
        'jsfiddle' => true,
        'kaggle' => true,
        'keybase' => true,
        'keycdn' => true,
        'kickstarter' => true,
        'kickstarter-k' => true,
        'korvue' => true,
        'laravel' => true,
        'lastfm' => true,
        'lastfm-square' => true,
        'leanpub' => true,
        'less' => true,
        'line' => true,
        'linkedin' => true,
        'linkedin-in' => true,
        'linode' => true,
        'linux' => true,
        'lyft' => true,
        'magento' => true,
        'mailchimp' => true,
        'mandalorian' => true,
        'markdown' => true,
        'mastodon' => true,
        'maxcdn' => true,
        'medapps' => true,
        'medium' => true,
        'medium-m' => true,
        'medrt' => true,
        'meetup' => true,
        'megaport' => true,
        'mendeley' => true,
        'microsoft' => true,
        'mix' => true,
        'mixcloud' => true,
        'mizuni' => true,
        'modx' => true,
        'monero' => true,
        'napster' => true,
        'neos' => true,
        'nimblr' => true,
        'nintendo-switch' => true,
        'node' => true,
        'node-js' => true,
        'npm' => true,
        'ns8' => true,
        'nutritionix' => true,
        'odnoklassniki' => true,
        'odnoklassniki-square' => true,
        'old-republic' => true,
        'opencart' => true,
        'openid' => true,
        'opera' => true,
        'optin-monster' => true,
        'osi' => true,
        'page4' => true,
        'pagelines' => true,
        'palfed' => true,
        'patreon' => true,
        'paypal' => true,
        'penny-arcade' => true,
        'periscope' => true,
        'phabricator' => true,
        'phoenix-framework' => true,
        'phoenix-squadron' => true,
        'php' => true,
        'pied-piper' => true,
        'pied-piper-alt' => true,
        'pied-piper-hat' => true,
        'pied-piper-pp' => true,
        'pinterest' => true,
        'pinterest-p' => true,
        'pinterest-square' => true,
        'playstation' => true,
        'product-hunt' => true,
        'pushed' => true,
        'python' => true,
        'qq' => true,
        'quinscape' => true,
        'quora' => true,
        'r-project' => true,
        'raspberry-pi' => true,
        'ravelry' => true,
        'react' => true,
        'reacteurope' => true,
        'readme' => true,
        'rebel' => true,
        'red-river' => true,
        'reddit' => true,
        'reddit-alien' => true,
        'reddit-square' => true,
        'redhat' => true,
        'renren' => true,
        'replyd' => true,
        'researchgate' => true,
        'resolving' => true,
        'rev' => true,
        'rocketchat' => true,
        'rockrms' => true,
        'safari' => true,
        'salesforce' => true,
        'sass' => true,
        'schlix' => true,
        'scribd' => true,
        'searchengin' => true,
        'sellcast' => true,
        'sellsy' => true,
        'servicestack' => true,
        'shirtsinbulk' => true,
        'shopware' => true,
        'simplybuilt' => true,
        'sistrix' => true,
        'sith' => true,
        'sketch' => true,
        'skyatlas' => true,
        'skype' => true,
        'slack' => true,
        'slack-hash' => true,
        'slideshare' => true,
        'snapchat' => true,
        'snapchat-ghost' => true,
        'snapchat-square' => true,
        'soundcloud' => true,
        'sourcetree' => true,
        'speakap' => true,
        'speaker-deck' => true,
        'spotify' => true,
        'squarespace' => true,
        'stack-exchange' => true,
        'stack-overflow' => true,
        'staylinked' => true,
        'steam' => true,
        'steam-square' => true,
        'steam-symbol' => true,
        'sticker-mule' => true,
        'strava' => true,
        'stripe' => true,
        'stripe-s' => true,
        'studiovinari' => true,
        'stumbleupon' => true,
        'stumbleupon-circle' => true,
        'superpowers' => true,
        'supple' => true,
        'suse' => true,
        'symfony' => true,
        'teamspeak' => true,
        'telegram' => true,
        'telegram-plane' => true,
        'tencent-weibo' => true,
        'the-red-yeti' => true,
        'themeco' => true,
        'themeisle' => true,
        'think-peaks' => true,
        'trade-federation' => true,
        'trello' => true,
        'tripadvisor' => true,
        'tumblr' => true,
        'tumblr-square' => true,
        'twitch' => true,
        'twitter' => true,
        'twitter-square' => true,
        'typo3' => true,
        'uber' => true,
        'ubuntu' => true,
        'uikit' => true,
        'uniregistry' => true,
        'untappd' => true,
        'ups' => true,
        'usb' => true,
        'usps' => true,
        'ussunnah' => true,
        'vaadin' => true,
        'viacoin' => true,
        'viadeo' => true,
        'viadeo-square' => true,
        'viber' => true,
        'vimeo' => true,
        'vimeo-square' => true,
        'vimeo-v' => true,
        'vine' => true,
        'vk' => true,
        'vnv' => true,
        'vuejs' => true,
        'waze' => true,
        'weebly' => true,
        'weibo' => true,
        'weixin' => true,
        'whatsapp' => true,
        'whatsapp-square' => true,
        'whmcs' => true,
        'wikipedia-w' => true,
        'windows' => true,
        'wix' => true,
        'wizards-of-the-coast' => true,
        'wolf-pack-battalion' => true,
        'wordpress' => true,
        'wordpress-simple' => true,
        'wpbeginner' => true,
        'wpexplorer' => true,
        'wpforms' => true,
        'wpressr' => true,
        'xbox' => true,
        'xing' => true,
        'xing-square' => true,
        'y-combinator' => true,
        'yahoo' => true,
        'yammer' => true,
        'yandex' => true,
        'yandex-international' => true,
        'yarn' => true,
        'yelp' => true,
        'yoast' => true,
        'youtube' => true,
        'youtube-square' => true,
        'zhihu' => true,
    );

    public function getClass($icon)
    {
        return h(self::findNamespace($icon) . ' fa-' . $icon);
    }

    public static function findNamespace($icon)
    {
        return isset(self::FAB_ICONS[$icon]) ? 'fab' : 'fas';
    }
}
